package Review;

class Node{
    public int data;
    public Node left;
    public Node right;
}
public class BinaryTree {
    public static void pre(Node root){
        if(root == null){
            return;
        }
        System.out.println(root.data+" ");
        pre(root.left);
        pre(root.right);
    }
    //获取树中节点的个数
    public static int size(Node root){
        if(root == null){
            return 0;
        }
        int leftsize = size(root.left);
        int rightsize = size(root.right);
        return leftsize+rightsize+1;
    }
}
